/*
 *    Copyright (c) 2018-2025, cloud All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: cloud
 */

package com.fuyao.cloud.flowable.feign;

import com.fuyao.cloud.common.core.constant.SecurityConstants;
import com.fuyao.cloud.common.core.constant.ServiceNameConstants;
import com.fuyao.cloud.common.core.util.R;
import com.fuyao.cloud.flowable.vo.ReturnVo;
import com.fuyao.cloud.flowable.vo.StartProcessInstanceVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(contextId = "remoteFlowableService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteFlowableService {

	/**
	 * 启动流程
	 * @param params 参数对象
	 */
	@PostMapping(value = "/api/flow/startProcessInstanceByKey", produces = "application/json")
	ReturnVo<String> startProcessInstanceByKey(@RequestBody StartProcessInstanceVo params);

	/**
	 * 删除流程实例
	 * @param processInstanceId 流程实例 ID
	 * @param from 内部调用标志
	 */
	@DeleteMapping("/flowable/runtime/deleteByProcessInstanceId/{processInstanceId}")
	R<Boolean> deleteByProcessInstanceId(@PathVariable("processInstanceId") String processInstanceId, @RequestHeader(SecurityConstants.FROM) String from);


	/**
	 * 删除流程实例
	 * @param businessKey 业务 businessKey
	 * @param from 内部调用标志
	 */
	@DeleteMapping("/flowable/runtime/deleteByBusinessKey/{businessKey}")
	R<Boolean> deleteByBusinessKey(@PathVariable("businessKey") String businessKey, @RequestHeader(SecurityConstants.FROM) String from);
}
